package com.abetsy.vben.api;

import com.abetsy.vben.param.SharePreviewParam;
import com.abetsy.vben.service.TMDBService;
import com.abetsy.vben.utils.api.ResultData;
import com.abetsy.vben.vo.ShareDramaInfoVo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Share资源
 */
@RestController
@RequestMapping("/share")
@CrossOrigin(origins = "*")
public class ShareController {

    @Resource
    private TMDBService tmdbService;

    /**
     * Drama资源预览
     */
    @PostMapping("/drama/preview")
    public ResultData<ShareDramaInfoVo> sharePreview(@RequestBody @Validated SharePreviewParam param) {
        return ResultData.success(tmdbService.sharePreview(param));
    }

    /**
     * Drama资源删除
     */
    @PostMapping("/drama/delete")
    public ResultData<Object> shareDelete(@RequestBody @Validated SharePreviewParam param) {
        return ResultData.success(tmdbService.shareDelete(param));
    }

}
